<template>
	<view class="datapage">
		<view class="bannertitle">
			<view class="iconfont icon-shuju-05">
				
			</view>
	         随访计划
		</view>
		<view class="planbox">
			<view class="itemplan">
				<view class="name">
					今日随访
				</view>
				<view class="daybox">
					09/28
				</view>
			</view>
			<view class="itemplan">
				<view class="name">
					本周随访
				</view>
				<view class="daybox">
					10/01-10/07
				</view>
			</view>
		</view>
		
		
		
		
		<view class="teambox">
			<view class="teamline">
				<view class="bannertitle">
					<view class="iconfont icon-rili2">
						
					</view>
				   待审核事项
				</view>
					<view class="teammore">
						查看更多
					</view>
			</view>
				<view class="teamlist">
					<view style="text-align: center;color: #cccccc;"  v-if="daishenhelist.length==0">
						暂无数据
					</view>
					<view class="itemteam" v-for="item in daishenhelist" :key="item.memberId" @click="godetail(item)">
						<view class="left">
							<view class="imgbox">
								<image  :src="item.imgUrl ? 'https://changban.dianjingkeji.net' + item.member.imgUrl : 'https://changban.dianjingkeji.net/img/微信图片_20250923172704_692_133.jpg'" mode=""></image>
							</view>
							<view class="infobox">
								<view class="name">
									{{item.memberName||'新用户'}}
								</view>
								<view class="type">
									{{item.yzStatus==1?'待提交':'待审核'}}
									
								</view>
							</view>
						</view>
						<view class="morebtn">
							<view class="time">
							{{item.time}}
							</view>
							<view class="timelabel">
								剩余时间
							</view>
						</view>
					</view>
					
				</view>
		</view>
		
		<view class="teambox">
			<view class="teamline">
				<view class="bannertitle">
					<view class="iconfont icon-weixin2">
						
					</view>
				   用户沟通
				</view>
					<view class="teammore">
						查看更多
					</view>
			</view>
			   <view class="msgbox">
			   	  团队消息
			   </view>
				<view class="teamlist">
					<view class="itemteam"  v-for="item in msglist" :key="item.teamId" @click="gotalk(item)">
						<view class="left">
							<view class="imgbox">
								<view class="num" v-if="item.lastMessage.unreadCount!=0">
									{{item.lastMessage.unreadCount}}
								</view>
								<image src="https://changban.dianjingkeji.net/img/微信图片_20230817153730.jpg" mode=""></image>
							</view>
							<view class="infobox">
								<view class="name">
									{{item.teamName}}
								</view>
								<view class="type">
									{{item.lastMessage.lastMessageContent}}
								</view>
							</view>
						</view>
						<view class="right">
							{{item.lastMessage.lastMessageTime}}
						
						</view>
						
					</view>
					
				</view>
				
		
		</view>
		
		
		
		
		
		
		
		
		
		<view class="foot-tabbar">
			<view class="itemfootbar" @click="gohome">
				<image src="/static/tabbar/首页 (1).png" mode=""></image>
				<view class="tabbarname ">
					首页
				</view>
			</view>
			<view class="itemfootbar " @click="goxueshu">
				<image src="/static/tabbar/学位帽.png" mode=""></image>
				<view class="tabbarname ">
					学术
				</view>
			</view>
			<view class="itemfootbar footbardata">
				<image src="/static/tabbar/first-aid-kit-fill.png" mode=""></image>
				<view class="tabbarname  footact">
					随访
				</view>
			</view>
			<view class="itemfootbar" @click="gouser">
				<image src="/static/tabbar/团队.png" mode=""></image>
				<view class="tabbarname ">
					用户
				</view>
			</view>
			<view class="itemfootbar" @click="gocenter">
				<image src="/static/tabbar/我的.png" mode=""></image>
				<view class="tabbarname ">
					我的
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	import {getPendingMedicalOrdersList,getUnreadSummaryByDoctor} from '../../utils/api.js'
	export default {
		data() {
			return {
				daishenhelist:[],
				timer:'',
				msglist:[]
			}
		},
		onShow() {
			let p={
				phone:uni.getStorageSync('phone')
			}
			getPendingMedicalOrdersList(p).then(res=>{
				if(res.data.code==200){
					console.log(res,'待审核')
					this.daishenhelist=res.data.data
					getUnreadSummaryByDoctor(p).then(res=>{
						console.log(res,'未读消息')
						this.msglist=res.data.data
					})
				}
				
			})
		
			
		},
		mounted() {
			this.timer=setInterval(function() {
                     let p={
                     	phone:uni.getStorageSync('phone')
                     }
                     getPendingMedicalOrdersList(p).then(res=>{
                     	console.log(res,'待审核')
                     	this.daishenhelist=res.data.data
                     })
               }, 5000); 
			
		},
		methods: {
			
			
			
			gotalk(e){
				let id=e.teamId
				let name=e.teamName
				uni.navigateTo({
					url:'/pagesA/talk/talk?id='+id+'&name='+name
				})
			},
			godetail(e){
				console.log(e)
				let id=e.memberId
				uni.navigateTo({
					url:'/pagesB/fangan/fangan?id='+id
				})
			},
			gohome(){
				uni.redirectTo({
					url:'/pages/index/index'
				})
			},
			goxueshu(){
				uni.redirectTo({
					url:'/pages/xueshu/xueshu'
				})
			},
			gocenter(){
				uni.redirectTo({
					url:'/pages/center/center'
				})
			},
			gouser(){
				uni.redirectTo({
					url:'/pages/user/user'
				})
			},
		},
		onHide(){
			clearInterval(this.timer);
			this.timer=''
		},
		beforeDestroy(){
			clearInterval(this.timer);
			this.timer=''
		}
	}
</script>

<style lang="less" scoped>
	.datapage{
		width: 750rpx;
		box-sizing: border-box;
		padding-bottom: 250rpx;
		background-color: whitesmoke;
		.bannertitle{
			display: flex;
			align-items: center;
				
			padding: 20rpx 30rpx;
			font-size: 36rpx;
			font-weight: bold;
			color: #1a4f8a;
			.iconfont{
				font-size: 40rpx;
				color: #1a4f8a;
				font-weight: bold;
				margin-right: 20rpx;
			}
		}
		.planbox{
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: space-evenly;
			box-sizing: border-box;
			padding: 20rpx;
			.itemplan{
				width: 47%;
				height: 180rpx;
				border-radius: 20rpx;
				box-sizing: border-box;
				padding: 20rpx;
				line-height: 2;
				background-color: white;
				 box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.3);
				.name{
					font-weight: bold;
					color: #1a4f8a;
				}
				.daybox{
					font-size: 30rpx;
					color: gray;
				}
			}
			
		}
		
		.teambox{
			width: 100%;
			box-sizing: border-box;
			padding: 20rpx;
			.teamline{
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.bannertitle{
					display: flex;
					align-items: center;
					
					padding: 20rpx 30rpx;
					font-size: 36rpx;
					font-weight: bold;
					color: #1a4f8a;
					.iconfont{
						font-size: 50rpx;
						color: #1a4f8a;
						font-weight: bold;
						margin-right: 20rpx;
					}
				}
				.teammore{
					color: #1a4f8a;
				}
				.teambtn{
					width: 200rpx;
					height: 80rpx;
					color: white;
					font-size: 30rpx;
					text-align: center;
					line-height: 80rpx;
					border-radius: 20rpx;
					background-color: #1a4f8a;
				}
			}
			.msgbox{
				font-size: 30rpx;
				font-weight: bold;
				color: #1a4f8a;
				margin-bottom: -20rpx;
			}
			.teamlist{
				width: 100%;
				box-sizing: border-box;
				padding: 20rpx;
				background-color: white;
				border-radius: 20rpx;
				margin-top: 30rpx;
				 box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.3);
			   .itemteam{
				   width: 100%;
				   height: 90rpx;
				   display: flex;
				   align-items: center;
				   justify-content: space-between;
				   margin-bottom: 30rpx;
				   .left{
					   
					   display: flex;
					   align-items: center;
					   .imgbox{
						   width: 100rpx;
						   height: 100rpx;
						   border-radius: 50%;
						   position: relative;
						   .num{
							   position: absolute;
							   color: red;
							   border-radius: 50%;
							   font-size: 22rpx;
							   font-weight: bold;
							   top: 0;
							   right: -10rpx;
							  
						   }
						   image{
							   width: 100%;
							   height: 100%;
							    border-radius: 50%;
						   }
					   }
					  .infobox{
						  margin-left: 20rpx;
						  .name{
							  font-weight: bold;
							  
						  }
						  .type{
							  font-size: 28rpx;
							  width: 60%;
							  overflow: hidden;
							   text-overflow: ellipsis;
							    white-space: nowrap;
							  
						  }
					  }
				   }
				   .right{
					   font-size: 24rpx;
					   text-align: center;
				   }
				   .morebtn{
					   width: 160rpx;
					     height: 100%;
						
					  .time{
						  font-weight: bold;
						  font-size: 40rpx;
						  color: red;
					  }
					  .timelabel{
						  font-size: 28rpx;
					  }
				   }
			   }
				
			}
			
		}
		
		
		.foot-tabbar{
			width: 100%;
			height: 150rpx;
			position: fixed;
			left: 0;
			right: 0;
			bottom: 0;
			display: flex;
			align-items: center;
			justify-content: space-evenly;
			background: white;
			overflow: visible;  /* 允许溢出 */
			
			.itemfootbar{
				width: 20%;
				height: 100%;
				text-align: center;
				image{
					width: 60rpx;
					height: 60rpx;
					margin: auto;
				}
				.tabbarname{
					font-size: 28rpx;
					color: #969696;
				}
				.footact{
					color: #1a4f8a;
				}
				
			}
			.footbardata{
				height: 200rpx !important;
				background: white !important;
				box-sizing: border-box;
				padding-top: 25rpx;
				border-top-right-radius: 75rpx;
				border-top-left-radius: 75rpx;
				
			}
		}
	}

</style>
